﻿
@{
    ViewBag.Title = "延迟任务列表";
    ViewBag.nav = "delayTask";
    var plist = ViewBag.plist as StaticPagedList<DelayTask>;
}

<a class="layui-btn layui-btn-danger layui-btn-sm" href="@Url.Action("edit")">
    <i class="layui-icon">&#xe654;</i>
    任务
</a>

<hr />

<form method="get" class="layui-form">

    <label>名称：</label>
    <div class="layui-input-inline">
        <input type="text" name="name" id="name" value="@Request["name"]" class="layui-input" />
    </div>
    <button class="layui-btn">查询</button>
</form>

<table class="layui-table">
    <thead>
        <tr>
            <th>编号</th>
            <th>名称</th>
            <th>url</th>
            <th>方法</th>
            <th>数据</th>
            <th>执行次数</th>
            <th>重试次数</th>
            <th>重试秒数</th>
            <th>超时秒数</th>
            <th>成功标识</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in plist)
        {
            <tr>
                <td>@item.Id</td>
                <td>@item.Name</td>
                <td>@item.Url</td>
                <td>@item.Method</td>
                <td>@item.PostData</td>
                <td>@item.ExecCount</td>
                <td>@item.RetryCount/@item.MaxRetryCount</td>
                <td>@item.RetrySeconds</td>
                <td>@item.TimeoutSeconds</td>
                <td>@item.SuccessFlag</td>
                <td>@item.AddTime.ToString("yyyy-MM-dd HH:mm:ss")</td>
                <td>
                    <div class="layui-btn-group">
                        <button class="layui-btn layui-btn-sm layui-btn-danger" type="button" onclick="del(@item.Id)">删除</button>
                        <a class="layui-btn layui-btn-sm layui-btn-normal" href="@Url.Action("list","executelog",new { taskType=2, taskId=item.Id})">日志</a>
                        <a class="layui-btn layui-btn-sm" href="@Url.Action("edit",new { id=item.Id})">修改</a>
                    </div>
                </td>
            </tr>
        }
    </tbody>
</table>

@Html.PagedListPager(plist)

@section scripts{
    <script>
        function del(id) {
            if (confirm("确定要删除吗?")) {
                $.post("@Url.Action("dodelete")", { id: id }, function (ro) {
                    alert(ro.Msg);
                    if (ro.Success) {
                        location.reload();
                    }
                });
            }
        }
    </script>
}